<?php
/**
 * Here the class \UF\NotImplementedException is defined.
 *
 * @category   UniKap-Framework
 * @package    Core
 * @subpackage Exceptions
 * @author     Ulf -UniKado- Kadner <ulfikado@gmail.com>
 * @since      2014-03-29 16:17
 * @version    0.1
 */

namespace UF
{

    /**
     * This exception should be used, if a currently not implemented method, function or functionality
     * is called.
     *
     * @since  v0.1
     */
    class NotImplementedException extends \UF\Exception
    {

        # <editor-fold defaultstate="collapsed" desc="- - - >   C O N S T R U C T O R   - - - - - - - - - - - - - - - - - - - - - - - -">

        /**
         * Inits a new instance.
         *
         * @param  string $message A optional error message
         * @param  int $code A optional error code (Defaults to \E_ERROR)
         * @param  \Exception $previous An optional previous exception
         * @since  v0.1
         */
        public function __construct( $message = null, $code = \E_ERROR, \Exception $previous = null )
        {
            $trace = \debug_backtrace();
            $lidx  = \count($trace) - 1;
            $type = !empty( $trace[$lidx]['class'] )
                ? ( 'Method ' . $trace[$lidx]['class'] . $trace[$lidx]['type'] .  $trace[$lidx]['function'] . '(…)' )
                : ( !empty( $trace[$lidx]['function'] )
                    ? ( 'Function ' . $trace[$lidx]['function'] . '(…)' )
                    : 'Code at ' . $trace[$lidx]['file']);
            parent::__construct(
                $type . ' is not implemented yet!' .
                ( empty( $message ) ? '' : " {$message}" ), empty( $code ) ? \E_ERROR : $code, $previous );
        }

        # </editor-fold>

    }

}